<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="common/include :: header('新增养修预约记录')"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-appointment-add">
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">客户姓名：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="customerName" id="customerName" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">联系方式：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="customerPhone" id="customerPhone" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">预约时间：</label>
            <div class="col-sm-8">
                <div class="input-group date">
                    <input name="appointmentTime" class="form-control" placeholder="yyyy-MM-dd HH:mm"
                           type="text" required>
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">车牌号码：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="licensePlate" id="licensePlate" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">汽车类型：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="carSeries" id="carSeries" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">服务类型：</label>
            <div class="col-sm-8">
                <div class="radio-box" th:each="dict : ${@dict.getType('cmi_service_type')}">
                    <input type="radio" th:id="${dict.id}" name="serviceType" th:value="${dict.value}"
                           th:checked="${dict.isDefault}">
                    <label th:for="${dict.id}" th:text="${dict.label}"></label>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">备注：</label>
            <div class="col-sm-8">
                <textarea id="info" name="info" class="form-control"></textarea>
            </div>
        </div>
    </form>
</div>
<th:block th:include="common/include :: footer"/>
<th:block th:include="common/include :: datetimepicker"/>
<script type="text/javascript">
    var prefix = ctx + "/business/appointment";


    $("input[name='appointmentTime']").datetimepicker({
        format: "yyyy-mm-dd hh:ii",
        autoclose: true
    });
    $("#form-appointment-add").validate({
        rules: {
            customerPhone: {
                isPhone: true
            }
        },
        messages: {
            "customerPhone": "手机格式不正确"
        },
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/add", $('#form-appointment-add').serialize());
        }
    }

</script>
</body>
</html>
